//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System;
using System.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Common.Instrumentation.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Configuration;
using EntLibContrib.Resource.Configuration;

namespace EntLibContrib.Resource.Tests
{
	static class TestConfigurationSource
	{
		public static DictionaryConfigurationSource GenerateConfiguration ()
		{
			DictionaryConfigurationSource sections = new DictionaryConfigurationSource();
			sections.Add(DatabaseSettings.SectionName, GenerateDatabaseSettings());
			sections.Add(ResourceManagerSettings.SectionName, GenerateResourceManagerSettings());
			return sections;
		}

		private static DatabaseSettings GenerateDatabaseSettings ()
		{
			DatabaseSettings settings = new DatabaseSettings();
			return settings;
		}

		private static ResourceManagerSettings GenerateResourceManagerSettings ()
		{
			ResourceManagerSettings settings = new ResourceManagerSettings();
			settings.DefaultResourceManager = "DataResourceManager1";

			settings.ResourceManagers.Add(new ResourceManagerData("AssemblyResourceManager", "AssemblyResourceProvider"));
			settings.ResourceManagers.Add(new ResourceManagerData("DataResourceManager1", "DataResourceProvider"));
			settings.ResourceManagers.Add(new ResourceManagerData("DataResourceManager2", "DataResourceProvider"));

			settings.ResourceProviders.Add(new AssemblyResourceProviderData("AssemblyResourceProvider", "EntLibContrib.Resource.TestStore", "EntLibContrib.Resource.TestStore.Properties.Resources"));
			settings.ResourceProviders.Add(new DataResourceProviderData("DataResourceProvider", "ResourceDatabase", "Test"));
			return settings;
		}
	}
}
